{template "header.html"}
<div class="note note-danger">
    <p>模板消息发送对象是已关注本公众号的粉丝</p>
</div>

<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {$form}
    <div class="row myfbody">
        <div class="col-md-12">

<div class="form-horizontal">
    <div class="portlet bordered light ">
        <div class="portlet-title tabbable-line">
            <ul class="nav nav-tabs" style="float:left;">
                {loop $module $dir $t}
                <li class="{if $page == $dir}active{/if}">
                    <a href="#tab_{$dir}" data-toggle="tab" onclick="$('#dr_page').val('{$dir}')"> <i class="{dr_icon($t.icon)}"></i> {$t.name} </a>
                </li>
                {/loop}
            </ul>
        </div>
        <input type="hidden" id="dr_page" value="{$page}">
        <div class="portlet-body">
            <div class="tab-content" style="padding-top: 30px">

                {loop $module $dir $m}
                {php $i=$dir;}
                <div class="tab-pane {if $page==$dir}active{/if}" id="tab_{$dir}">

                        <div class="tab-pane {if $i == $page}active{/if}" id="tab_{$i}">

                            <div class="form-body">

                                <div class="form-group">
                                    <label class="col-md-2 control-label">可用状态</label>
                                    <div class="col-md-9">
                                        <input type="checkbox" name="data[{$dir}][use]" value="1" {if $data[$dir]['use']}checked{/if} data-on-text="{dr_lang('已开启')}" data-off-text="{dr_lang('已关闭')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                        <span class="help-block">{dr_lang('开启后会出现在模块记录列表中')}</span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-md-2 control-label ">{dr_lang('模版ID')}</label>
                                    <div class="col-md-6">
                                        <input type="text" class="form-control"  name="data[{$dir}][id]" value="{$data[$dir]['id']}">
                                        <span class="help-block">在微信公众号中-功能-模板消息-我的模板：模板ID</span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-md-2 control-label ">{dr_lang('主题颜色')}</label>
                                    <div class="col-md-6">
                                        <label> <input type="text" class="form-control"  name="data[{$dir}][color]" value="{$data[$dir]['color']}"></label>
                                        <span class="help-block">微信消息主题显示的颜色，例如：红色是#ff0000</span>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="col-md-2 control-label ">{dr_lang('模板内容参数')}</label>
                                    <div class="col-md-9">
                                        <table class="table table-mtotal table-nomargin table-bordered table-striped table-bordered table-advance">
                                            <thead>
                                            <tr>
                                                <th width="200">参数名</th>
                                                <th width="200">颜色</th>
                                                <th>参数值</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            {php for ($i = 0;$i < 10 ;$i++) { }

                                            <?php
if (!isset($data[$dir]['content'])) {
$data[$dir]['content'] = [];
}

                    ?>
                                            <tr>
                                                <td><input type="text" class="form-control" name="data[{$dir}][content][{$i}][name]" value="{$data[$dir]['content'][$i]['name']}"></td>
                                                <td><input type="text" class="form-control" name="data[{$dir}][content][{$i}][color]" value="{$data[$dir]['content'][$i]['color']}"></td>
                                                <td><textarea class="form-control" style="height:80px" name="data[{$dir}][content][{$i}][value]">{$data[$dir]['content'][$i]['value']}</textarea></td>
                                            </tr>
                                            {php } }
                                            </tbody>
                                        </table>
                                    </div>
                                </div>


                            </div>
                        </div>

                </div>
                {/loop}

            </div>
        </div>
    </div>

</div>


    <div class="portlet-body form myfooter">
        <div class="form-actions text-center">

            <label><button type="button" onclick="dr_ajax_submit('{dr_now_url()}&page='+$('#dr_page').val(), 'myform', '2000')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('保存内容')}</button></label>

        </div>
    </div>
</form>


{template "footer.html"}